﻿using Microsoft.EntityFrameworkCore;
using 订单处理系统.Model;

namespace 订单处理系统.Entity
{
    public class OrderDbContext : DbContext
    {
        public DbSet<MessageLog> MessageLogs { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<OrderItem> OrderItems { get; set; }
        public DbSet<Payment> Payments { get; set; }

        public DbSet<Product> Products { get; set; }
        public DbSet<StockLog> Stocks { get; set; }

        public DbSet<User> Users { get; set; }

        public OrderDbContext(DbContextOptions<OrderDbContext> options):base(options)
        {
        }

        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //{
        //    string connStr = "Data Source=127.0.0.1,1434;User Id=sa;Password=123;Initial Catalog=orderSystem;Encrypt=True;TrustServerCertificate=True;Pooling=true;Min Pool Size=1";
        //    optionsBuilder.UseSqlServer(connStr);
        //    optionsBuilder.LogTo(msg =>
        //    {
        //        if (msg.Contains("CommandExecuted"))
        //            Console.WriteLine(msg);
        //    });
        //}

        //protected override void OnModelCreating(ModelBuilder modelBuilder)
        //{
        //    base.OnModelCreating(modelBuilder);
        //}
    }
}